#include "wx/wxprec.h"
#include "wx/xrc/xh_gdctl.h"
#include "wx/dirctrl.h"

IMPLEMENT_DYNAMIC_CLASS( wxGenericDirCtrlXmlHandler, wxXmlResourceHandler )

wxGenericDirCtrlXmlHandler::wxGenericDirCtrlXmlHandler()
  : wxXmlResourceHandler() {
  XRC_ADD_STYLE( wxDIRCTRL_DIR_ONLY );
  XRC_ADD_STYLE( wxDIRCTRL_3D_INTERNAL );
  XRC_ADD_STYLE( wxDIRCTRL_SELECT_FIRST );
  XRC_ADD_STYLE( wxDIRCTRL_SHOW_FILTERS );
  XRC_ADD_STYLE( wxDIRCTRL_EDIT_LABELS );
  AddWindowStyles();
}

wxObject *wxGenericDirCtrlXmlHandler::DoCreateResource() {
  XRC_MAKE_INSTANCE( ctrl, wxGenericDirCtrl )
  ctrl->Create( m_parentAsWindow,
                GetID(),
                GetText( wxT( "defaultfolder" ) ),
                GetPosition(), GetSize(),
                GetStyle(),
                GetText( wxT( "filter" ) ),
                ( int )GetLong( wxT( "defaultfilter" ) ),
                GetName() );
  SetupWindow( ctrl );
  return ctrl;
}

bool wxGenericDirCtrlXmlHandler::CanHandle( wxXmlNode *node ) {
  return IsOfClass( node, wxT( "wxGenericDirCtrl" ) );
}
